home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2008 April / PCgo 2008-04 (DVD).iso / interface / contents / demoversionen_3846 / 13664 / files / Data1.cab / turbocad_test4.vbs < prev    next >
Encoding:
Text File  |  2001-10-16  |  1.4 KB  |  91 lines

  1. 'Script to test getting/setting reference point of the graphic
  2.  
  3. Option Explicit
  4.  
  5. Dim tcApp
  6.  
  7. sub ShowRefPoint(tcGr, bUseWorldCS)
  8.  
  9. Dim tcVrtRef
  10. Dim strMsg
  11.  
  12.     Set tcVrtRef = tcGr.ReferencePoint(bUseWorldCS)
  13.  
  14.     strMsg = "RefPoint of " & CStr(tcGr.ID)
  15.     strMsg = strMsg & Chr(13) & Chr(10)
  16.  
  17.     strMsg = strMsg & "X = " & CStr(tcVrtRef.X)
  18.     strMsg = strMsg & Chr(13) & Chr(10)
  19.  
  20.     strMsg = strMsg & "Y = " & CStr(tcVrtRef.Y)
  21.     strMsg = strMsg & Chr(13) & Chr(10)
  22.  
  23.     strMsg = strMsg & "Z = " & CStr(tcVrtRef.Z)
  24.     strMsg = strMsg & Chr(13) & Chr(10)
  25.  
  26.     if (Not bUseWorldCS) then
  27.         strMsg = strMsg & "(Local CS)"
  28.     else
  29.         strMsg = strMsg & "(World CS)"
  30.     end if
  31.  
  32.     msgBox strMsg
  33. end sub
  34.  
  35. Sub EditRefPoint(tcGr)
  36.  
  37. Dim tcVrtRef
  38.  
  39.  
  40.     ShowRefPoint tcGr, false
  41.     ShowRefPoint tcGr, true
  42.  
  43.     Set tcVrtRef = tcGr.ReferencePoint
  44.  
  45.     tcVrtRef.X = tcVrtRef.X + 1
  46.     tcVrtRef.y = tcVrtRef.y + 1
  47.     tcVrtRef.z = tcVrtRef.z + 1
  48.  
  49.     ShowRefPoint tcGr, false
  50.  
  51.  
  52. end sub
  53.  
  54. Sub UpdateSelector()
  55.  
  56. Dim tcSel
  57.  
  58.     Set tcSel = tcApp.Selection
  59.     if (tcSel.Count = 0) then exit sub
  60.  
  61.     tcSel(0).Select
  62.  
  63.  
  64. end sub
  65.  
  66.  
  67. Sub Main()
  68.  
  69. Dim tcDwg
  70. Dim tcGrs
  71. Dim tcGr
  72.  
  73.     Set tcDwg = tcApp.ActiveDrawing
  74.     
  75.     Set tcGrs = tcDwg.Graphics
  76.  
  77.     for each tcGr in tcgrs
  78.         EditRefPoint(tcGr)
  79.     next
  80.  
  81.     UpdateSelector    
  82.  
  83. end sub
  84.  
  85.     Set tcApp = CreateObject("TurboCAD.Application")
  86.     tcApp.Visible = True
  87.  
  88.     Main
  89.  
  90.     MsgBox "Done"
  91.